Fix gRPC BoardListWatch crashing when installing/uninstalling a core/lib #1460
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)Fixes a bug in the gRPC interface.
Calling one of the following gRPC function:
PlatformInstall
PlatformUninstall
PlatformUpgrade
LibraryInstall
LibraryUninstall
LibraryUpgradeAll
crashes the
arduino-cli daemon
if theBoardListWatch
process for theinstance
used to call the aforementioned functions is running.Calling one of the following gRPC function:
PlatformInstall
PlatformUninstall
PlatformUpgrade
LibraryInstall
LibraryUninstall
LibraryUpgradeAll
stops the
BoardListWatch
process for theinstance
used to call the aforementioned functions, the connected clients will be notified theBoardListWatch
process is quitting.If the client will need to restart the
BoardListWatch
process it must wait for the above functions to return a response.titled accordingly?
Nope.
This bug is caused by the internal workings of the Arduino CLI daemon.
gRPC clients using the CLI must first
Create
a newinstance
that is used to keep track of installed platforms, tools, discoveries and libraries, thatinstance
is populated with data using theInit
function. Since there can be multiple clients connection via gRPC we might have multipleinstance
s internally to keep track of.The
Init
function can also be used on an already initializedinstance
so the first thing we do is "clean" thatinstance
, that means also stopping all the pluggable discovery processes that are running, doing that while theBoardListWatch
process is running causes the bug being fixed by this PR.The best possible solution would have been to notify the
BoardListWatch
process that the discoveries are quitting and act accordingly by restarting it after the initialization step has finished but that would require a big paradigm change in the internal logic of the CLI that we can't bear as of now, thus this solution.See how to contribute